package org.zjx.battle.engines;

import org.zjx.account.enums.Sects;
import org.zjx.battle.EngineType;
import org.zjx.battle.IBattleEngine;
import org.zjx.battle.entity.Battle;
import org.zjx.common.command.ICommand;
import org.zjx.common.command.battle.FightCommand;
import org.zjx.common.command.battle.FightSpellCommand;
import org.zjx.common.model.RouteProperties;

import java.util.List;
import java.util.Map;


public class NormalBattleEngine implements IBattleEngine {

    @Override
    public ICommand analyzeAndGenerateCommands(RouteProperties routeProperties, Battle battle) {

        int count = 0;
        List<Integer> bloods = battle.getBloods();
        for (int i = 0; i < bloods.size(); i++) {
            if(bloods.get(i) < 90){
                if(count++ >= 1 && routeProperties.getSects() == Sects.HUA_SHENG_SI){
                    return new FightSpellCommand(i, "推气过宫");
                }
            }

        }
        return new FightCommand(1);
    }

    @Override
    public EngineType getEngineType() {
        return EngineType.NORMAL_BATTLE;
    }

    @Override
    public boolean isApplicable(Battle battle) {
        return true;
    }
}
